package org.perche.chat.client.widgets.room;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class RoomWidget extends Composite implements ClickHandler {

	private static RoomWidgetUiBinder uiBinder = GWT
			.create(RoomWidgetUiBinder.class);

	interface RoomWidgetUiBinder extends UiBinder<Widget, RoomWidget> {
	}
	
	@UiField Label titleLabel;

	public RoomWidget() {
		initWidget(uiBinder.createAndBindUi(this));
		
		this.draw();
	}
	
	private void draw() {
		// can be done with uiBinder but it's for exemple !
		this.titleLabel.setTitle(RoomWidgetMessages.INSTANCE.roomTitle());
	}

	@UiHandler("titleLabel")
	public void onClick(ClickEvent event) {
		// just for exemple
		Window.alert(RoomWidgetMessages.INSTANCE.roomTitle());
	}

}
